home *** CD-ROM | disk | FTP | other *** search
/ F1 Licenseware / F1 Licenseware - Volume 1.iso / disks / 089a.dms / 089a.adf / TEXTS / CHAPTERS_1-10 / Chapter02.txt < prev    next >
Text File  |  1992-03-06  |  3KB  |  67 lines

  1.                      The Absolute Beginners Guide To Amos
  2.                     -------------------------------------
  3.                                  Chapter Two
  4.                                  -----------
  5. Before we continue on to more commands there are a few things I would like
  6. to explain.
  7.  
  8. The program in EXAMPLE1.Amos used seven lines for the actual code as we
  9. should now understand these commands it would be nice to squash them all
  10. up on one line.  We can do this easily by using a colon (:) between each
  11. command like this:
  12.  
  13. CURS OFF: HIDE: PAPER 0: CLS 0: PRINT "Testing...": WAIT KEY: EDIT
  14.  
  15. This will work exactly the same as the program in Example1.Amos.
  16.  
  17. This is not regarded as good programming practice by purists as it can make
  18. long programs run a frame or two slower and can make listings a bit
  19. confusing to follow, but the choice is yours. Personally, I have no 
  20. preference either way.
  21.  
  22. Something else you will have come across is the REM statement. REM is short
  23. for REMark and serves as a good description of it's use.  As Amos ignores
  24. ANYTHING after a REM you can use it to put REMarks and comments in your
  25. program listings.
  26.  
  27. REM tells Amos not to bother about the rest of that particular line
  28. For example:
  29.  
  30. REM I can put want I want here with no worries
  31.  
  32. You can even use REM at the end of a line of instructions like this:
  33.  
  34. CURS OFF: REM wibble wibble rhubarb
  35.  
  36. But you cannot do this:
  37.  
  38. CURS OFF: REM CLS 0
  39.  
  40. Well you can do it, but Amos will never execute the CLS 0 instruction, it 
  41. will think CLS 0 is a comment of yours.
  42.  
  43. If you are not impressed with REM then you can use ` instead:
  44.  
  45. ` I can put anything I want here with no worries
  46.  
  47. But you cannot use an apostrophe like this
  48.  
  49. CURS OFF ` this will cause a syntax error
  50.  
  51. CURS OFF: 'So will this! :CLS 3
  52.  
  53. What, you may ask is all the fuss about REM and ` ? As they don`t seem to do
  54. a lot?  Well, just observe my comments in the example programs and it will
  55. soon become clear how useful commenting a program can be, especially in 
  56. complex programs where you have to keep track of lots of variables, ha! 
  57. That's a nice link to chapter three where we learn about variables amongst 
  58. other things. 
  59.  
  60. Time to LOAD up EXAMPLE2.Amos and mess around with the listing. Although
  61. it's the same boring program as Example1.Amos I urge you to take a quick 
  62. peek, just to make everything very clear in your mind about REM and '. 
  63. Don`t forget to take notes on everything you learn.
  64.  
  65.                              End of chapter two
  66.                              ^^^^^^^^^^^^^^^^^^
  67.